﻿using System;
using System.Collections.Generic;
using System.Text;
using MobileBroadbandLoggingMonitorGUI.UI.Interfaces;
using MobileBroadbandLoggingMonitorUI.Interfaces;
using System.Diagnostics;
using MobileBroadbandLoggingMonitorUI.UI.Interfaces;

namespace MobileBroadbandLoggingMonitorGUI.UI
{
    public class GetProPresenter : IGetProPresenter
    {
        IGetProView _proview;
        ISettings _settings;
        IWeb _web;
        private bool _initialized;

        public GetProPresenter(IGetProView proview, ISettings settings, IWeb web)
        {
            _proview = proview;
            _settings = settings;
            _web = web;
        }

        public override void ShowDialog()
        {
            InitializeViewAndPresenter();
            _proview.ShowDialog();
        }

        private void InitializeViewAndPresenter()
        {
            if (!_initialized)
            {
                _proview.OKClick += new EventHandler(_proview_OKClick);
                _proview.GetProLinkClick += new EventHandler(_proview_GetProLinkClick);
                _initialized = true;
            }
        }

        void _proview_GetProLinkClick(object sender, EventArgs e)
        {
            _web.ShowWebPage(_settings.PROBuyNowURL());
        }

        void _proview_OKClick(object sender, EventArgs e)
        {
            _proview.Visible = false;
        }



    }
}
